﻿@using PagedList.Mvc;

@model PagedList.IPagedList<Product>

@section styles{
    @Styles.Render("~/Content/PagedList.css")
}

@{
    Event eventt = ViewBag.Event;
    Category category = eventt.Category;
    string deadlineFormat = ViewBag.DeadlineFormat;

    int index = 0;

    ViewBag.MenuOneId = category.Id;
    ViewBag.Title = String.Format("{0} - Sự kiện thời trang {1}", eventt.Name, category.Name.ToLower());
}

<div id="event" class="details">
    <div class="container">
        <div class="bg-content event-info">
            <div class="row">
                <div class="col-md-4">
                    <img class="img-responsive" src="@eventt.ImageUrl" />
                </div>
                <div class="col-md-8">
                    <div class="bg-title">
                        <h4>@eventt.Name</h4>
                    </div>
                    <div class="description">
                        @Html.Raw(eventt.Description)
                    </div>
                    <hr />
                    <div class="deadline">
                        <span class="label">@(String.Format(deadlineFormat, eventt.EndDate))</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-pagelist" style="margin-bottom: 10px;">
            <div class="row">
                <div class="col-sm-4">
                    <div class="well-sm">
                        <span class="badge">@Model.FirstItemOnPage</span>
                        - <span class="badge">@Model.LastItemOnPage</span>
                        / <span class="badge">@Model.TotalItemCount</span>
                    </div>
                </div>
                <div class="col-sm-8 text-right">
                    @Html.PagedListPager(Model, page => Url.Action(null, new
                    {
                        page,
                        categoryNameId = eventt.Category.NameId,
                        eventNameId = eventt.NameId
                    }), new PagedListRenderOptions
                    {
                        LinkToFirstPageFormat = DataTableConstant.LinkToFirstPageFormat,
                        LinkToPreviousPageFormat = DataTableConstant.LinkToPreviousPageFormat,
                        LinkToNextPageFormat = DataTableConstant.LinkToNextPageFormat,
                        LinkToLastPageFormat = DataTableConstant.LinkToLastPageFormat,
                        MaximumPageNumbersToDisplay = 5
                    })
                </div>
            </div>
        </div>
        <div class="row min-padding">
            @foreach (Product item in Model)
            {
                index++;
                
                <div class="col-md-4 col-sm-6 col-xs-6">
                    @Html.Action("_ProductItem", "Product", new { product = item, lazyLoad = true })
                </div>               

                if (index % 3 == 0)
                {
                    <div class="clearfix visible-lg visible-md"></div>
                }
                if (index % 2 == 0)
                {
                    <div class="clearfix visible-sm visible-xs"></div>
                }
            }
        </div>
        <hr />
        <div class="form-pagelist">
            <div class="row">
                <div class="col-sm-4">
                    <div class="well-sm">
                        <span class="badge">@Model.FirstItemOnPage</span>
                        - <span class="badge">@Model.LastItemOnPage</span>
                        / <span class="badge">@Model.TotalItemCount</span>
                    </div>
                </div>
                <div class="col-sm-8 text-right">
                    @Html.PagedListPager(Model, page => Url.Action(null, new
                    {
                        page,
                        categoryNameId = eventt.Category.NameId,
                        eventNameId = eventt.NameId
                    }), new PagedListRenderOptions
                    {
                        LinkToFirstPageFormat = DataTableConstant.LinkToFirstPageFormat,
                        LinkToPreviousPageFormat = DataTableConstant.LinkToPreviousPageFormat,
                        LinkToNextPageFormat = DataTableConstant.LinkToNextPageFormat,
                        LinkToLastPageFormat = DataTableConstant.LinkToLastPageFormat,
                        MaximumPageNumbersToDisplay = 5
                    })
                </div>
            </div>
        </div>
    </div>
</div>
<br />

@section scripts {
    <script>
        $('#menuOne-@category.NameId').addClass('active');
        $('#menuTwo-@category.NameId').addClass('active');
        $('#menuTwoXs-@category.NameId').addClass('active');
        $('.lazy-load').lazyload();
    </script>
}

